package com.sunnada.edu.business.contract.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.sunnada.edu.system.pub.dao.BaseDaoImpl;

@Repository
public  class ContractDaoImpl extends BaseDaoImpl implements ContractDao {

	@Override
	public int getContractCots(HashMap<String, String> params) {
		List list = selectList("contract_sqlmap.getWorkerContractCots", params);
		if (list != null && list.size() > 0) {
			String cot = ((Map) list.get(0)).get("COT") + "";
			return Integer.valueOf(cot);
		}
		return 0;
	}

	@Override
	public List<?> findContracts(HashMap<String, String> params) {
		return selectList("contract_sqlmap.findWorkerContracts", params);
	}
	
	


	@Override
	public int contractDelete(HashMap<String, String> params) {
		return delete("contract_sqlmap.contractDelete", params);
	}

	@Override
	public int contractAdd(HashMap<String, String> params) {
		return insert("contract_sqlmap.contractAdd", params);
	}
	


	@Override
	public int contractUpdate(HashMap<String, String> params) {
		return update("contract_sqlmap.contractUpdate", params);
	}
	


	@Override
	public Map getContractByRecId(HashMap<String, String> params) {
		List list = selectList("contract_sqlmap.getWorkerContractByRecId", params);
		if (list != null && list.size() > 0) {
			return (Map) list.get(0);
		}
		return null;
	}

	@Override
	public Map<String, String> getContract(HashMap<String, String> params) {
		List list = selectList("contract_sqlmap.getContract", params);
		if (list != null && list.size() > 0) {
			return (Map) list.get(0);
		}
		return null;
	}


	@Override
	public int contractEnable(HashMap<String, String> params) {
		return update("contract_sqlmap.contractEnable", params);
	}

	@Override
	public int contractDisable(HashMap<String, String> params) {
		return update("contract_sqlmap.contractDisable", params);
	}



}
